//
//  MSButton.m
//  住房条件帅选器
//
//  Created by MB__Lee on 2018/5/15.
//  Copyright © 2018年 MB__Lee. All rights reserved.
//

#import "MSButton.h"


@implementation MSButton

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        
        [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [self setTitleColor:[UIColor greenColor] forState:UIControlStateSelected];
        [self setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
        [self setImage:[UIImage imageNamed:@""] forState:UIControlStateSelected];
    }
    return  self;
}

-(CGRect)imageRectForContentRect:(CGRect)contentRect{

    CGFloat imgvWidth = 10;
    CGFloat imgvHight = 10;
    
    
    CGFloat x = CGRectGetMaxX(contentRect) - imgvWidth;
    CGFloat y = (CGRectGetMaxY(contentRect) - imgvHight ) *0.5;
    return  CGRectMake(x, y, imgvWidth, imgvHight);
}


-(CGRect)titleRectForContentRect:(CGRect)contentRect{
    
    CGFloat imgvWidth =  10;
    CGFloat imgvHight =  15;
    
    CGFloat y = (CGRectGetMaxY(contentRect) - imgvHight ) *0.5;
    CGFloat labelWidth = CGRectGetMaxX(contentRect) - imgvWidth;
    
    return   CGRectMake(0, y, labelWidth, imgvHight);
}


@end
